<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
	String filePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort()+"/file/";
%>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<meta name="renderer" content="webkit|ie-comp|ie-stand">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta http-equiv="Cache-Control" content="no-siteapp" />
<script type="text/javascript" src="<%=basePath%>js/jquery-1.9.0.min.js"></script>
<script type="text/javascript" src="<%=basePath%>js/xadmin.js"></script>
<link rel="stylesheet" href="<%=basePath%>css/font.css">
<link rel="stylesheet" href="<%=basePath%>css/xadmin.css">
<script src="<%=basePath%>lib/layui/layui.js" charset="utf-8"></script>
<script src="<%=basePath%>js/pc/admin/commodityAddition.js"
	charset="utf-8"></script>
</head>
<body class="layui-anim layui-anim-up">
	<div class="x-nav">
		<span class="layui-breadcrumb"> <a id="aClass">商品管理</a> <a>
				<cite>商品添加/修改</cite>
		</a>
		</span> <a class="layui-btn layui-btn-small"
			style="line-height: 1.6em; margin-top: 3px; float: right"
			onclick="location.reload()" title="刷新"> <i
			class="layui-icon layui-icon-refresh" style="line-height: 35px;"></i></a>
	</div>

	<div class="layui-container">
		<div class="layui-row">
			<div class="layui-col-md9" style="padding-top: 25px">

				<form class="layui-form layui-form-pane" method="post">

					<input type="hidden" id="cId" value="${obj.cId}" name="cId">

					<div class="layui-form-item">
						<label class="layui-form-label">商品名称:</label>
						<div class="layui-input-block">
							<input maxlength="16" id="cName" type="text" value="${obj.cName }" name="cName"
								required lay-verify="cName" placeholder="请输入商品名称"
								autocomplete="off" class="layui-input">
						</div>
					</div>
					<div class="layui-form-item">
						<label class="layui-form-label">商品描述:</label>
						<div class="layui-input-block">
							<input maxlength="32" id="cDescribe" type="text" value="${obj.cDescribe}"
								name="cDescribe" required lay-verify="cDescribe"
								placeholder="请输入商品描述" autocomplete="off" class="layui-input">
						</div>
					</div>
					<div class="layui-form-item">
						<label class="layui-form-label">商品价格:</label>
						<div class="layui-input-block">
							<input id="cPrice" type="text" name="cPrice"
								value="${obj.cPrice}" required lay-verify="cPrice"
								placeholder="请输入商品价格" autocomplete="off" class="layui-input">
						</div>
					</div>
					<div class="layui-form-item">
						<label class="layui-form-label">商品成本:</label>
						<div class="layui-input-block">
							<input id="cNum" maxlength="5" type="text" value="${obj.cNum}" name="cNum"
								required lay-verify="cNum" placeholder="请输入商品库存"
								autocomplete="off" class="layui-input">
						</div>
					</div>
					<div class="layui-form-item">
						<label class="layui-form-label">选择小类:</label>
						<div class="layui-input-block">
						
							<c:if  test="${obj == null}">
								<select name="cType" lay-filter="business">
									<option value="">按类别查找</option>
									<c:forEach items="${cateList}" var="item">
										<option value="${item.cId}">${item.cName}</option>
									</c:forEach>
								</select>
							</c:if>
							<c:if test="${obj != null}">
								<select name="cType" lay-filter="business">
									<option value="${obj.cType }">${obj.typeName}</option>
								</select>
							</c:if>
						</div>
					</div>
					<input type="hidden" id="cPhotodatails" value="${obj.cPhtotoDescribe}" name="cPhotodatails">
					
					<div class="layui-form-item">
						<label class="layui-form-label">商品详情:</label>
						<div class="layui-input-block">
							<button type="button" class="layui-btn" id="test1">
								<i class="layui-icon">&#xe67c;</i>上传图片
							</button>
							<button type="button" class="layui-btn back1">
							  <i class="layui-icon">&#xe65c;</i>
							</button>
						</div>
					</div>
					<div class="layui-form-item">
						<blockquote class="layui-elem-quote" id="demo1">
							<!-- 图片预览 -->
							<c:if test="${obj!= null}">
								<c:forEach items="${obj.cPhtotoDescribe.split(',')}" var="item">
									<img src="<%=filePath%>${item}" style="width: 100px;height: 100px">						
								</c:forEach>
							</c:if>
						</blockquote>
					</div>
					<div class="layui-form-item">
						<label class="layui-form-label">商品轮播:</label>
						<div class="layui-input-block">
							<button type="button" class="layui-btn" id="test2">
								<i class="layui-icon">&#xe67c;</i>添加图片
							</button>
							<button type="button" class="layui-btn back">
							  <i class="layui-icon">&#xe65c;</i>
							</button>
						</div>
					</div>
					<div class="layui-form-item">
						<blockquote class="layui-elem-quote" id="demo2">
							<!-- 图片预览 -->
							<c:if test="${obj!= null}">
								<c:forEach items="${obj.cPhtoto.split(',')}" var="item">
									<img src="<%=filePath%>${item}" style="width: 100px;height: 100px">						
								</c:forEach>
							</c:if>
						</blockquote>
					</div>
					<input type="hidden" id="fileupload" value="${obj.cPhtoto}" name="cPhoto">
					<div class="layui-form-item">
						<div class="layui-input-block">
							<button id="buttonClass" class="layui-btn" lay-submit lay-filter="formDemo">提交修改</button>
						</div>
					</div>
				</form>
			</div>
		</div>
	</div>
</body>
</html>